package main

import (
	`fmt`
	`time`
)

func worker(done chan bool) {
	fmt.Print("working...")
	time.Sleep(time.Second)
	fmt.Println("done")
	//发送一个值来通知我们已经完工啦。
	done <- true
}

func main() {

	//缓冲
	msg := make(chan string, 2)
	msg <- "adad"
	msg <- "55"
	println(<-msg)
	msg <- "222"
	println(<-msg)
	println(<-msg)

	done := make(chan bool, 1)
	go worker(done)
	<-done


}
